<template>
  <div class="content">
    <!-- <div class='type' @click='show=!show'>分类</div>
    <div class="typeList" v-show='show'>
      <div class="list">
        <div class='items'>
          <div class="btn">全部</div>
        </div>
        <div class="title">支付状态</div>
        <div class='items'>
          <div class="btn disabled">支付成功</div>
          <div class="btn">支付失败</div>
        </div>
        <div class="title">支付补录</div>
        <div class='items'>
          <div class="btn">待补录</div>
          <div class="btn selected">补录中</div>
          <div class="btn">补录成功</div>
        </div>
        <van-button block>确认</van-button>
    </div>-->
    <!-- </div> -->
    <!-- <div class="month">2020.09</div> -->
    <div class="list" v-if="list.length!=0">
      <div class="item" v-for="(item,i) in list" :key="i" @click="toDetail(i)">
        <div class="info">
          <div class="line">
            {{item.in_station_name}}
            <span>
              <img src="../assets/arrow-right.png" alt />
            </span>
            {{item.out_station_name}}
          </div>
          <div class="time">
            <span>{{`${item.in_time.slice(0,4)}-${item.in_time.slice(4,6)}-${item.in_time.slice(6,8)}` }}</span>
            <span>{{`${item.in_time.slice(8,10)}:${item.in_time.slice(10,12)}:${item.in_time.slice(12,16)}`}}</span>
          </div>
        </div>
        <div class="right">
          <van-icon name="arrow" />
        </div>
      </div>
    </div>
    <van-empty
      class="custom-image"
      image="https://img.yzcdn.cn/vant/custom-empty-image.png"
      description="暂无数据"
      v-if="list.length==0"
    />
  </div>
</template>

<script>
import { getUserBind, getWalletAccount } from "../api";
export default {
  data() {
    return {
      show: false,
      list: [
        {
          from: "河海大学佛城西路",
          to: "南京南站",
          date: "2020-09-27",
          time: "07:50:02"
        },
        {
          from: "河海大学佛城西路",
          to: "南京南站",
          date: "2020-09-27",
          time: "07:50:02"
        },
        {
          from: "河海大学佛城西路",
          to: "南京南站",
          date: "2020-09-27",
          time: "07:50:02"
        },
        {
          from: "河海大学佛城西路",
          to: "南京南站",
          date: "2020-09-27",
          time: "07:50:02"
        },
        {
          from: "河海大学佛城西路",
          to: "南京南站",
          date: "2020-09-27",
          time: "07:50:02"
        },
        {
          from: "河海大学佛城西路",
          to: "南京南站",
          date: "2020-09-27",
          time: "07:50:02"
        },
        {
          from: "河海大学佛城西路",
          to: "南京南站",
          date: "2020-09-27",
          time: "07:50:02"
        },
        {
          from: "河海大学佛城西路",
          to: "南京南站",
          date: "2020-09-27",
          time: "07:50:02"
        },
        {
          from: "河海大学佛城西路",
          to: "南京南站",
          date: "2020-09-27",
          time: "07:50:02"
        }
      ],
      datas: {
        user_id: localStorage.getItem("user_id"),
        month: "202012"
      }
    };
  },
  created() {
    this.GetListImg();
  },
  methods: {
    toDetail(index) {
      this.$router.push({
        name: "orderDetail",
        params: {
          tripVal: this.list[index].trip_no
        }
      });
    },
    GetListImg() {
      let datas = this.datas;
      this.$http
        .post("https://m.mynj.cn:11005/metro/trip/queryTripInfo", datas)
        .then(res => {
          this.list = res.data.data;
        });
    }
  }
};
</script>

<style lang="scss" scoped>
.content {
  height: 100vh;
  box-sizing: border-box;
  background-color: #f2f2f2;
  font-family: PingFangSC-Semibold, PingFang SC;
  .custom-image {
    // background-color: red;
    .van-empty__image {
      border: 1px solid red;
      width: 1px;
      height: 1px;
    }
  }
  .type {
    padding: 9px 15px;
    background: #f2f2f2;
    border-bottom: 5px solid #fff;
    position: relative;
    &::after {
      content: " ";
      position: absolute;
      transform: rotate(-45deg);
      border: 5px solid #666;
      border-color: transparent transparent #666 #666;
      left: 49px;
      top: 8px;
      width: 0;
      height: 0;
    }
  }
  .typeList {
    z-index: 100;
    position: absolute;
    left: 0;
    width: 100%;
    top: 38px;
    height: calc(100vh - 38px);
    background-color: #00000080;
    .list {
      padding: 18px 15px;
      background-color: #fff;
      .items {
        display: flex;
        .btn {
          margin-right: 15px;
          width: 90px;
          height: 30px;
          text-align: center;
          font-size: 13px;
          font-weight: 500;
          color: #0064f4;
          line-height: 30px;
          border-radius: 2px;
          border: 1px solid #0064f4;
          &.disabled {
            color: #c4c4c4;
            border: 1px solid #c4c4c4;
          }
          &.selected {
            color: #fff;
            border: 1px solid #1876ff;
            background: linear-gradient(137deg, #318bff 0%, #1876ff 100%);
          }
        }
      }
      .title {
        font-size: 16px;
        font-weight: 500;
        color: #333;
        margin: 16px 0;
      }
      button {
        margin-top: 28px;
        background: linear-gradient(137deg, #318bff 0%, #1876ff 100%);
        border-radius: 5px;
        font-size: 16px;
        font-weight: 500;
        color: #fff;
      }
    }
  }
  .month {
    padding: 9px 15px;
    font-size: 16px;
    font-weight: 600;
    color: #333;
  }
  .list {
    .item {
      background-color: #fff;
      padding: 11px 15px;
      display: flex;
      justify-content: space-between;
      .info {
        .line {
          display: flex;
          align-items: center;
          font-size: 16px;
          font-weight: 500;
          color: #333;
          margin-bottom: 10px;
          span {
            width: 18px;
            margin: 0 10px;
          }
        }
        .time {
          font-size: 14px;
          font-weight: 400;
          color: #999;
          span {
            margin-right: 10px;
          }
        }
      }
      .right {
        display: flex;
        font-size: 20px;
        align-items: center;
        i {
          color: #444;
        }
      }
    }
  }
}
</style>